/*
 * @Descripttion: 文件说明
 * @version: 0.0.1
 * @Author: gaojiapeng
 * @Date: 2020-06-23 10:38:55
 * @LastEditors: gaojiapeng
 * @LastEditTime: 2021-03-15 10:39:16
 */
import service from "./request";
const baseUrl = window.config.baseApi;
const dlpbaseApi = window.config.dlpbaseApi;

// 主线往复杆数据
const GetDataZX = () =>
  service({
    url:  "/api/ZXWFG",
    method: "get"
  });
// 副线往复杆数据
const GetDataFX = () =>
  service({
    url:  "/api/action",
    method: "get"
  });

// 底架往复杆数据
const GetDataDJFX = () =>
  service({
    url:  "/af/action",
    method: "get"
  });

// 液压站1#
const GetDataY1 = () =>
  service({
    url:  "/ab/function",
    method: "get"
  });
// 液压站2#
const GetDataY2 = () =>
  service({
    url:  "/ac/function1",
    method: "get"
  });
// 液压站3#
const GetDataY3 = () =>
  service({
    url:  "/ad/function2",
    method: "get"
  });
// 液压站4#
const GetDataY4 = () =>
  service({
    url:  "/ae/function3",
    method: "get"
  });

// 首页数据
const GetData = () =>
  service({
    url:  "/api",
    method: "get"
  });

// 首页数据
const GetToken = () =>
  service({
    url:  "https://dlpbe.yuzhen-iot.com/oauth/token?grant_type=client_credentials",
    method: "post"
  });

// dlp时间开动率
const GetDlpOee = (data) =>
  service({
    url:  dlpbaseApi + "reporting/v1/oee_a_pc_reports",
    method: "post",
    data:data
  });
// dlp车间产量计数
const GetDlpSCCount = (data) =>
  service({
    url:  dlpbaseApi + "reporting/v1/workshops/device_product_count",
    method: "post",
    data:data
  });
// dlp车间设备状态
const GetDlpreal_time_status = (data) =>
  service({
    url:  dlpbaseApi + "machinestatus/v1/workshops/real_time_status?workshopId="+data,
    method: "get"
  });
// dlp车间设备状态
const Getall_machine_status = (workshopId,data) =>
  service({
    url:  dlpbaseApi + "machinestatus/v1/all_machine_status?workshopId="+workshopId,
    method: "post",
    data:data
  });
// 根据车间ids，列举设备
const Getby_workshopids = (data) =>
  service({
    url:  dlpbaseApi + "tpm/v1/devices/by_workshopids?workshopIds="+data,
    method: "get"
  });
// 根据产险获取设备
// tpm/v1/devices?schemeLevel=3&schemeId=48949601346342912
const Getby_Line = (level, data) =>
    service({
        url:  dlpbaseApi + `tpm/v1/devices?schemeLevel=${level}&schemeId=`+data,
        method: "get"
    });
// 获取数结构
const GetTrees = () =>
    service({
        url:  dlpbaseApi + "schema/v1/scheme_tree",
        method: "get"
    });
// 根据车间ids，列举设备
const Getdevices= () =>
  service({
    url:  dlpbaseApi + "tpm/v1/devices:enable",
    method: "get"
  });
// 查询机台plc实时数据
const Getmachine_plc_realdata= (data) =>
  service({
    url:  dlpbaseApi + "machinestatus/v1/machine_plc_realdata?deviceId="+data,
    method: "get"
  });
export {
  GetData,
  GetDataZX,
  GetDataFX,
  GetDataY1,
  GetDataY2,
  GetDataY3,
  GetDataY4,
    Getby_Line,
  GetDataDJFX,
    GetTrees,
  GetToken,
  GetDlpOee,
  GetDlpSCCount,
  GetDlpreal_time_status,
  Getall_machine_status,
  Getby_workshopids,
  Getdevices,
  Getmachine_plc_realdata
};
